
<div class="center">
	<div class="home">
    	<div class="home_left">
            <?php echo $this->partial('tuan/menu.phtml',array('menuId'=>$this->menuId,'user'=>$this->user,'uCount'=>$this->uCount)); ?>
        </div>
        <div class="home_right">
            <script type="text/javascript">
                $(function(){
                   $(".all").click(function(){
                       if($(this).attr('checked'))
                           $('input:checkbox').not(this).attr('checked', 'true');
                       else
                           $('input:checkbox').not(this).removeAttr('checked');
                   }); 
                   $('.Pageform a').click(function(){
                       $('#start').val($(this).attr('href').substr(7));
                       $(this).parents('form').submit();
                   });
                   $('.Search_left li').hover(function(){
                       $('.Dropdown_list',this).show();
                   }, function(){
                       $('.Dropdown_list',this).hide();
                   });
                   $('.Search_left .Dropdown_list a').click(function(){
                       $('a.Dropdownlist',$(this).parents('.Dropdown_list').prev()).html($(this).text());
                       $(this).parents('.Dropdown_list').hide();
                       return false;
                   });
                   $('._time a').click(function(){
                       $('#time').val($(this).attr('href').substr(1));
                       $('form').submit();
                   });
                   $('._status a').click(function(){
                       $('#status').val($(this).attr('href').substr(1));
                       $('form').submit();
                   });
                });
            </script>
			<div class="daigou_top">
            	<h1>我的代购订单</h1>
            </div>
            
                <div style="text-align:right">
                    <a href="/tuan/myorder/status/0">未付款</a>
                    <a href="/tuan/myorder/status/1">等待下单</a>
                    <a href="/tuan/myorder/status/2">已受理</a>
                    <a href="/tuan/myorder/status/3">等待卖家发货</a>
                    <a href="/tuan/myorder/status/4">卖家已发货</a>
                    <a href="/tuan/myorder/status/5">已入库</a>
                    <a href="/tuan/myorder/">全部</a>
                </div>
            <div class="baobeilist">
            	<div class="list_top">
                    <table>
                        <tr>
                            <th class="b1">宝贝信息</th>
                            <th class="b2">单价</th>
                            <th class="b3">数量</th>
                            <th class="b4">实付款(元)</th>
                            <th class="b5">交易状态</th>
                            
                        </tr>
                    </table>
                </div>
                <div class="list_table" style="margin-top:10px;">
                    <?php if (count($this->orderList)==0) {?>
                	<div class="Nogoods">
                        <div class="no_pic">
                            没有购买宝贝
                        </div>
                        <div class="NOsm">
                            <h2>您还没有通过悠奇购买过宝贝！</h2>
                            <p>猜您接下来会：<a href="/purchase/agent">我要代购</a></p>
                        </div>
                    </div>
                    <?php } else {
                        foreach ($this->orderList as $order){
                    ?>
                	<table class="NewDD">
                    	<tr>
                        	<th colspan="4">
                        <div class="dd_info"><span>订单编号：<?= $order->getOrderNum() ?></span><span>时间：<?php echo $order->DateCreated ?></span>用户ID:<?= $order->UserId ?> <a href="/tuan/mystore?userid=<?= $order->UserId ?>" target="_blank">仓库号：<?= $order->User->storeno ?></a> 昵称：<?= $order->User->Nikename ?></div>
                            </th>
                            <th colspan="2">
                                <?
                            switch($order->Status){
                                case  1:
                                    echo '<a href="/tuan/setorder?status=2&orderid='.$order->Id.'">设为已受理</a>';
                                    break;
                                case  2:
                                    echo '<a href="/tuan/setorder?status=3&orderid='.$order->Id.'">设为已下单</a>';
                                    break;
                                case 3:
                                    echo '<a href="/tuan/setorder?status=4&orderid='.$order->Id.'">设为卖家已发货</a>';
                                    break;
                                case 4:
                                    echo '<a href="/tuan/setorder?status=5&orderid='.$order->Id.'">设为已入库</a>';
                                    break;
                                
                            }
                                ?>
                            </th>
                        </tr>
                        <?php 
                        $count =0;
                        foreach($order->Items as $item){ 
                            $count++;
                            ?>
                        <tr>
                        	<td class="l1">
                                <div class="sp_pic">
                                    <a href="<?= $item->Product->Url ?>" target="_blank"><img src="<?php echo $item->Image ?>" alt="<?php echo $item->ProductName ?>" /></a>
                                </div>
                                <div class="sp_info">
                                    <h1><a href="<?php echo $item->Product->Url ?>" target="_blank"><?php echo $item->ProductName ?></a></h1>                                   
                                     
                                    <div class="zdy">
                                      <?= $item->Product->PropertyAlias ?>
                                      </div>      
                                                                         
                                    <div class="Remarks">
                                        <p>商品备注: <?php echo $item->Comment == NULL || $item->Comment == ''?'(无)':$item->Comment ?></p>
                                        <? if($item->Description){ ?>
                                        <p style="color:red"><?= $item->Description ?></p>
                                        <? } ?>
                                    </div>
                                </div>
                            </td>
                        	<td class="l2"><?php echo $item->Price ?><span style="color:red"><br /><?= $item->StatusText ?></span></td>
                        	<td class="l3"><?php echo $item->Quantity ?></td>
                            
                            <?php if ($count==1){?>
                            <td class="l4" rowspan="<?php echo count($order->Items) ?>">￥<?php echo $order->Sum ?>
                                <div class="zdy"><span><?= $order->ShipFee>0?('(含运费'.number_format($order->ShipFee). '元)'):'免运费' ?></span></div></td>
                        	<td class="l5" rowspan="<?php echo count($order->Items) ?>">
                                <?php 
switch ($order->Status){
    case Application_Model_Order::STATUS_PAYING:
        echo '<div class="fk"><a href="/Pay/paying?type=2&id='.$order->Id .'">'. $order->getStatusText(). '</a></div>';
        break;
    default :
        echo '<p class="lvse">'. $order->getStatusText().'</p>';
        break;
}
                                ?>
                            	
                            </td>
                        	
                            <?php }?>
                        </tr>
                           <?php }?>            
                        <tr><td colspan="5"><form action="/tuan/setorderno"><?= $this->formHidden('orderid',$order->Id) ?>  淘宝订单号：<?= $this->formText('ProcureNo',$order->ProcureNo) ?> 物流单号：<?= $this->formSelect('logistics', $order->logistics,'请选择',$this->shipTypes) ?><?= $this->formText('LogisticsNo',$order->LogisticsNo) ?> <input value="更新" type="submit"> </form> </td></tr>
                    </table>
                    <?php } 
                    }?>
                </div>
                <div class="toolbar">
                	<div class="toolbar_left">
                    </div>
                    <?php echo $this->partial('paging.phtml',array('pages'=>$this->orders)) ?>
                	</div>
            </div>
              
        </div>
    </div>
</div>

